/*
 * Copyright 2011 Focus Technology, Co., Ltd. All rights reserved.
 */
package com.tfc.analysis.fragment;

import com.tfc.analysis.entity.Keyword;
import com.tfc.analysis.utils.StringUtils;

/**
 * 默认高亮的方式。即使用
 * 
 * @author taofucheng
 */
public class ReplaceWithExceptFragment extends AbstractFragment {
	private String replaceTo = "*";

	/**
	 * 初始化开闭标签
	 * 
	 * @param replaceTo
	 *            将关键词的每个字替换成什么内容
	 */
	public ReplaceWithExceptFragment(char replaceTo) {
		this.replaceTo = String.valueOf(replaceTo);
	}

	public ReplaceWithExceptFragment(String replaceTo) {
		this.replaceTo = String.valueOf(replaceTo);
	}

	@Override
	public String format(Keyword word) {
		//可以根据properties进行处理，如：行业类型、业务类型等
		return StringUtils.repeat(replaceTo, word.getWordLength());
	}
}
